# 1.用类封装一个MyMath类，实现加、减、乘、除、幂、开放
class MyMath(object):
    def add(self, a, b):
        return a + b

    def sub(self, a, b):
        return a - b

    def mult(self, a, b):
        return a * b

    def div(self, a, b):
        return a / b

    def exponent(self, a, b):
        return a ** b

    def sqrt(a):
        return a ** (1/2)

print(MyMath)
calc = MyMath()
print(calc.exponent(2, 2))

# 2.自由课题，按自己的想法，将身边的事物抽象出一个类，并创建多个实例。
class Car(object):
    wheel = 4

bmw = Car()
print(bmw)
toyota = Car()
print(toyota)

# 3.创建多个继承作业2父类的子类。

class ambulance(Car):
    function = "heal the wounded and rescue the dying."

class pumper(Car):
    function = "put out a fire."

class bus(Car):
    function = "pick up passengers."

a = bus
print(a.wheel)
print(a.function)